﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class giao_dien_AddCustomer : System.Web.UI.Page
{
    CustomerBus customerBus = new CustomerBus();

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Customer customer = new Customer();
        CustomerBus custBus = new CustomerBus();
        customer.CustomerId = txtId.Text.Trim();
        customer.Username = txtName.Text.Trim();
        customer.Password = txtPass.Text.Trim();
        customer.Fullname = txtFullName.Text.Trim();
        try { 
              customer.Dateofbirth = DateTime.Parse(txtBirth.Text.Trim());
        }
        catch(Exception ex)
        {
            Response.Write(ex.Message);
        }
        if (rdMale.Checked)
        {
            customer.Gender = true;
        }
        else 
        {
            customer.Gender = false;
        }
        customer.Address = txtAddress.Text.Trim();
        customer.Phone = txtPhone.Text.Trim();
        

        string reult = custBus.addCustomer(customer);

        ScriptManager.RegisterStartupScript(this, typeof(Page), "shopflowers.com", "<script>alert('" + reult + "')</script>", false);
    }
}